﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Diagnostics;
using System.IO;


namespace T_BPI.Classes.Base
{
    public static class Utils
    {
        public static void Log(String message, params object[] args)
        {
            Debug.WriteLine(timenow() + fileNameAndLineNumber() + String.Format(message, args));
        }

        private static string timenow()
        {
            DateTime CurrTime = DateTime.Now;
            return CurrTime.ToString("dd-MM-yyyy H:mm:ss.fff ");
        }

        private static string fileNameAndLineNumber()
        {
            StackFrame frame = new StackFrame(2, true);
            string fileName = System.IO.Path.GetFileName(frame.GetFileName());
            fileName += " " + frame.GetMethod().DeclaringType.Name + " ~ " + frame.GetFileLineNumber() + " - ";

            return fileName;
        }
    }


}
